using System;
using System.ComponentModel.DataAnnotations;
using WalkingTec.Mvvm.Core;

namespace HengTong.Model.Db.SupplyChain.Material;

/// <summary>
/// 系统计量单位组
/// 用于管理和维护计量单位的分组信息，支持树形结构
/// </summary>
public class SysMeasureUnitGroup : TreePoco<SysMeasureUnitGroup>
{
    /// <summary>
    /// 计量单位组名称
    /// </summary>
    [Display(Name = "名称", Description = "计量单位组的显示名称")]
    [Required]
    [StringLength(64, ErrorMessage = "{0}长度不能超过{1}")]
    public string Name { get; set; }

    /// <summary>
    /// 计量单位组编码
    /// 用于系统内部识别的唯一编码
    /// </summary>
    [Display(Name = "编码", Description = "用于系统内部识别的唯一编码")]
    [StringLength(64, ErrorMessage = "{0}长度不能超过{1}")]
    public string Code { get; set; }
    
    /// <summary>
    /// 层级
    /// </summary>
    [Display(Name = "层级")]
    public int Level { get; set; }
    
    /// <summary>
    /// ERP系统ID
    /// 与外部ERP系统同步时使用的标识符
    /// </summary>
    [Display(Name = "ErpId", Description = "与外部ERP系统同步时使用的标识符")]
    [StringLength(50, ErrorMessage = "{0}长度不能超过{1}")]
    public string ErpId { get; set; }

    /// <summary>
    /// 计量单位组详细描述
    /// 用于存储该计量单位组的详细说明信息
    /// </summary>
    [Display(Name = "详情", Description = "用于存储该计量单位组的详细说明信息")]
    [StringLength(1024, ErrorMessage = "{0}长度不能超过{1}")]
    public string Description { get; set; }
    
    /// <summary>
    /// 计量单位组状态
    /// 表示该计量单位组的当前状态（如启用、禁用等）
    /// </summary>
    [Display(Name = "状态", Description = "计量单位组的当前状态（如启用、禁用等）")]
    public CommonState State { get; set; }
    
    /// <summary>
    /// 创建时间
    /// 记录该计量单位组的创建时间
    /// </summary>
    [Display(Name = "创建时间", Description = "记录该计量单位组的创建时间")]
    public DateTime? CreateTime { get; set; }
    
    /// <summary>
    /// 最后更新时间
    /// 记录该计量单位组的最后一次修改时间
    /// </summary>
    [Display(Name = "最后更新时间", Description = "记录该计量单位组的最后一次修改时间")]
    public DateTime? UpdateTime { get; set; }
    
    /// <summary>
    /// 备注
    /// </summary>
    [Display(Name = "备注", Description = "计量单位组的备注信息")]
    [StringLength(256)]
    public string Remark { get; set; }
    
    /// <summary>
    /// 创建人
    /// </summary>
    [StringLength(64)]
    [Display(Name = "创建人")]
    public string CreateBy { get; set; }
    
    /// <summary>
    /// 更新人
    /// </summary>
    [StringLength(64)]
    [Display(Name = "更新人")]
    public string UpdateBy { get; set; }
}

public class SysMeasureUnitGroupView : SysMeasureUnitGroup
{
    public string ParentName { get; set; }
    
    public bool IsSynced { get; set; }
}